﻿package mortal.game.view.common.guide.stepOperater
{
    import com.mui.utils.*;
    import mortal.component.window.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.guide.data.*;
    import mortal.game.view.common.guide.view.*;
    import mortal.mvc.core.*;

    public class AutoGuidePicture extends Object implements IAutoGuideSteper
    {
        private var _win:AutoGuidePictureWin;
        private var _data:AutoGuideData;

        public function AutoGuidePicture()
        {
            return;
        }// end function

        public function guide(param1:AutoGuideData, param2:Window = null) : void
        {
            this._data = param1;
            if (this._win == null)
            {
                this._win = UICompomentPool.getUICompoment(AutoGuidePictureWin);
            }
            this._win.show();
            this._win.callback = this.winCallback;
            this._win.autoGuideData = param1;
            return;
        }// end function

        private function winCallback(param1:int) : void
        {
            if (param1 == AutoGuidePictureWin.Click_Isee)
            {
                this.stop(this._data);
            }
            else
            {
                this.stop();
            }
            return;
        }// end function

        public function stop(param1:AutoGuideData = null) : void
        {
            if (this._win != null)
            {
                this._win.hide();
                this._win = null;
            }
            if (param1 != null)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideStepEnd, param1));
            }
            return;
        }// end function

    }
}
